<?php

namespace Home\Controller;

use Home\Controller\BaseController;

class IndexController extends BaseController {

    public function _initialize() {
//        parent::_initialize();
//
//        if (empty($this->user_id)) {
//            $this->error("请登录!", '', -1);
//        }
    }

    public function index() {
        $this->display();
    }

    public function goodsInfo() {
        $goods_id = I('goods_id', 0, 'intval');

        $where['is_del'] = 0;
        $where['status'] = 0;

        if ($goods_id != 0) {
            $where['goods_id'] = $goods_id;
        }

        $data = M('Goods')->field('goods_id,goods_name,head_img,price,trial_price,goods_desc')->where($where)->order('goods_id desc')->find();

        $this->success('获取成功', $data);
    }

}
